﻿@model Citi.Scheduler.WebUi.Models.CategoryModel
<script type="text/javascript">
    function closeDialogCategory() {
        $('#divUpdateCategory').modal('toggle');
        $('.modal').toggle();
        clearForm();
    }

    function clearForm() {
        $("#formActionForm").trigger('reset');
    }
</script>

@using (Ajax.BeginForm("ActionForm", "Category", new AjaxOptions { UpdateTargetId = "divIndexCategory", 
    InsertionMode = InsertionMode.Replace, OnComplete = "closeDialogCategory" }, new { id = "formActionForm" }))
{
    @Html.ValidationSummary(true)
@*  <fieldset>
        <legend>CategoryModel</legend>
*@
    
    <div class="editor-label">
        @Html.LabelFor(model => model.Name)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Name)
        @Html.ValidationMessageFor(model => model.Name)
    </div>

    <div class="editor-label">
        @Html.LabelFor(model => model.Description)
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.Description)
        @Html.ValidationMessageFor(model => model.Description)
    </div>
    
     <div class="editor-label">
        @Html.LabelFor(model => model.ParentId)
    </div>
    <div class="editor-field">
        @Html.DropDownListFor(model => model.ParentId, (IEnumerable<SelectListItem>) ViewBag.Parent)
    </div>
    
    @Html.Hidden("Active", true)
    
    if (Model != null)
    {
    @Html.HiddenFor(model => model.Id)
    }
    <p>
        <input type="submit" value="Save" class="hide" id="submitCategory" />
    </p>
@*</fieldset>*@
}
